package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstArticleCategoriesDao;
import com.financing.wap.dto.DstArticleCategoriesDTO;
import com.financing.wap.service.IDstArticleCategoriesService;
import com.financing.wap.util.DTOdateSetUtil;
import com.financing.wap.vo.UserArticleInfoCategoriesVO;
/**
 * dst_article_categories  
 * 文章分类 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstArticleCategoriesService")
public class DstArticleCategoriesServiceImpl implements IDstArticleCategoriesService{

	@Autowired
	private IDstArticleCategoriesDao dstArticleCategoriesDao;

	@Override
	public int insert(DstArticleCategoriesDTO dstArticleCategories) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstArticleCategories);
		DTOdateSetUtil.setUpdateInfo(dstArticleCategories);
		dstArticleCategories.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstArticleCategoriesDao.insert(dstArticleCategories);
	}

	@Override
	public void update(DstArticleCategoriesDTO dstArticleCategories) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstArticleCategories);
		dstArticleCategoriesDao.update(dstArticleCategories);
	}

	@Override
	public void updateForce(DstArticleCategoriesDTO dstArticleCategories) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstArticleCategories);
		dstArticleCategoriesDao.updateForce(dstArticleCategories);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstArticleCategoriesDao.delete(id);
	}
	
	@Override
	public List<DstArticleCategoriesDTO> queryList(DstArticleCategoriesDTO dstArticleCategories) throws SQLException {
		return dstArticleCategoriesDao.queryList(dstArticleCategories);
	}

	@Override
	public int queryListCount(DstArticleCategoriesDTO dstArticleCategories) throws SQLException {
		return dstArticleCategoriesDao.queryListCount(dstArticleCategories);
	}

	@Override
	public DstArticleCategoriesDTO loadById(Integer id) throws SQLException {
		return dstArticleCategoriesDao.loadById(id);
	}
 	@Override
	public DstArticleCategoriesDTO queryListGetFirst(DstArticleCategoriesDTO dstArticleCategories)
			throws SQLException {
		 List<DstArticleCategoriesDTO> queryList = queryList(dstArticleCategories);
		 if(queryList==null||queryList.size()==0){
			 return new DstArticleCategoriesDTO();
		 }
		 return queryList.get(0);
	}

}
